package com.wms.mapper;

import com.github.pagehelper.Page;
import com.wms.dto.UserPageQueryDTO;
import com.wms.entity.WmsUser;
import com.wms.vo.UserRoleVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    /**
     * 根据用户名查询
     * @param name
     * @return
     */
    @Select("select * from wms_user where user_name = #{name}")
    WmsUser findByUserName(String name);

    /**
     * 修改
     * @param info
     */
    void update(WmsUser info);

    /**
     * 分页查询
     * @param userPageQueryDTO
     * @return
     */
    Page<UserRoleVo> pageQuery(UserPageQueryDTO userPageQueryDTO);

    /**
     * 根据id查询
     * @param currentId
     * @return
     */
    @Select("select user_name from wms_user where user_id = #{currentId}")
    String getById(Long currentId);

    /**
     * 保存
     * @param user
     */
    void save(WmsUser user);

    /**
     * 批量删除
     * @param ids
     */
    void deleteByIds(List<Long> ids);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from wms_user where user_id = #{id}")
    WmsUser findById(Long id);

    /**
     * 根据用户名查询
     * @param name
     * @return
     */
    UserRoleVo getUserRoleVoById(String name);

    /**
     * 查询所有供应商
     * @return
     */
    List<WmsUser> getAll();
}
